/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.game.zone;

import com.smartfoxserver.v2.api.CreateRoomSettings;
import com.smartfoxserver.v2.api.ISFSApi;
import com.smartfoxserver.v2.core.ISFSEvent;
import com.smartfoxserver.v2.exceptions.SFSCreateRoomException;
import com.smartfoxserver.v2.exceptions.SFSException;
import com.smartfoxserver.v2.extensions.BaseServerEventHandler;
import log.Debug;

/**
 *
 * @author daz
 */
public class ServerReadyHandler extends BaseServerEventHandler {

    @Override
    public void handleServerEvent(ISFSEvent isfse) throws SFSException {
        makeRoom();
    }

    private void makeRoom() {
        Debug.line("make room");
        CreateRoomSettings settings = new CreateRoomSettings();
        settings.setName("The new room");
        settings.setMaxUsers(20);
        ISFSApi api = getApi();
        Debug.console("api :" + api);
        Debug.console("zone :" + getParentExtension().getParentZone().getName());
        try {
            api.createRoom(getParentExtension().getParentZone(), settings, null);
        } catch (SFSCreateRoomException ex) {
        }

    }
}
